var shakeMain = {
	timer1:'',
	timer2:'',
	init:function(){
		 $(".car1").animate({right:"600px"},2000);
		 $(".car2").animate({right:"400px"},2000);
		 $(".car3").animate({right:"200px"},2000);
		//准备按钮
		$(".gameReadyBtn").click(function(){
			$(".shake-title").hide()
			$(".SecondRound").hide()
			$(".readyNum").show()
			$(this).hide()
			$(".gameStartBtn").show()
		})
		//开始按钮
		$(".gameStartBtn").click(function(){
			$(".readyNum").hide()
			shakeMain.shakeFloorMove('shakeFloor')
			shakeMain.shakeBuldMove('shakeBuld')
			$(this).hide()
			shakeMain.timerOver()
		})
	},
	shakeFloorMove:function(div){
		var div = document.getElementsByClassName(div)[0]
			var _value = 0;
			shakeMain.timer1 = setInterval(function(){
				div.style.backgroundPosition=_value+"px"
				_value +=2
			},1000/60)
	},
	shakeBuldMove:function(div){
		var div = document.getElementsByClassName(div)[0]
			var _value = 0;
			shakeMain.timer2 = setInterval(function(){
				div.style.backgroundPosition=_value+"px"
				_value += 4
			},1000/60)
	},
	timerOver:function(){
		setTimeout(function(){
			window.clearInterval(shakeMain.timer1)
			window.clearInterval(shakeMain.timer2)
			$(".gameRestartBtn").show()
		},10000)
	}
}
